#include "ApplicationLayer.h"

void ApplicationLayer::Recv(vector<bit> data) {
	this->data = data;
};

vector<bit> ApplicationLayer::Send() {
	return data;
};

void ApplicationLayer::Exec(string s) {
	if (s == "DOWN") {
		string s = "5";
		vector<bit> add = Util::Encode(s);
		int len = data.size();
		for (int i = 0; i < len; ++i) {
			add.push_back(data[i]);
		}
		data = add;
	}
	else if (s == "UP"){
		data.erase(data.begin(), data.begin() + 8);
		int k = 1;
	}
};

void ApplicationLayer::SayHello() {
	cout << "Application Layer" << endl;
}

void ApplicationLayer::GetUserData(string s) {
	this->data = Util::Encode(s);
}
